package com.ellen.mac.chatdemo.adpter;

import android.content.Context;
import android.widget.SeekBar;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ellen.mac.chatdemo.R;
import com.ellen.mac.chatdemo.model.VoiceItem;
import com.ellen.mac.chatdemo.view.PlayButton;

import java.util.List;

/**
 * Created by j on 2017/12/13.
 */

public class VoiceAdpter  extends BaseQuickAdapter<VoiceItem, BaseViewHolder> {
    private Context context;
    public VoiceAdpter(int layoutResId, List data, Context context) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, VoiceItem item) {
        PlayButton playButton = helper.getView(R.id.chat_item_audio_play_btn);
        SeekBar seekbar = helper.getView(R.id.seekbar_item);
        seekbar.setMax(item.getMax());
        helper.setText(R.id.chat_item_audio_duration_view,item.getMax()+"");
        playButton.initSeekBar(seekbar,context);
        playButton.setPath(item.getPath());
        helper.addOnLongClickListener(R.id.voic_item);

    }
}
